require 'vim'

include VIM

def keymap(key, to)
    map_to_command(key, to) if to =~ /^:/
    map_to_key(key, to) if to =~ /^</
end

def map_to_command(key,command)
    Commands.imap(key, "<ESC>#{command}i")
    Commands.nmap(key, "#{command}")
    Commands.map(key, "#{command}")
end


def map_to_key(key, original_key)
    Commands.imap(key, original_key)
    Commands.nmap(key, original_key)
    Commands.map(key, original_key)
end

